package org.wendu.wdoa.recrep.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.wendu.wdoa.common.CurrentUser;
import org.wendu.wdoa.common.page.PageParam;
import org.wendu.wdoa.common.page.PageUtils;
import org.wendu.wdoa.newassi.dto.TaskRecDto;
import org.wendu.wdoa.recrep.dao.TaskRecDao;
import org.wendu.wdoa.recrep.dto.TRqueryDto;
import org.wendu.wdoa.recrep.model.TackRec;
import org.wendu.wdoa.recrep.service.TaskRecService;

import java.util.Date;
import java.util.List;
import java.util.Map;
@Service
public class TaskRecServiceImpl implements TaskRecService {
    @Autowired
    private TaskRecDao taskRecDao;
    @Override
    public Map<String, Object> getTRList(String userId, PageParam pageParam) {
        return PageUtils.getPage(pageParam,()->taskRecDao.getTaskRecList(userId,pageParam));
    }

    @Override
    public void recTake(TRqueryDto tRqueryDto) {
        tRqueryDto.setTr_receive_date(new Date());
        taskRecDao.receiveTask(tRqueryDto);
    }

    @Override
    public List<TackRec> getTaskInformation(String userId,  String task_id) {
        return taskRecDao.getTaskInformation(userId,task_id);
    }

    @Override
    public void submitTaskInformation(TaskRecDto taskRecDto) {
        taskRecDto.setTr_submit_date(new Date());
        taskRecDao.submitTask(taskRecDto);
    }
}
